import React, { Component } from 'react'
import LoginBox from './components/LoginBox'
import getGlobalContext from "../../utils/getGlobalContext";


export default class LoginPage extends Component {
  myRef = React.createRef()
  getRef() {
    console.log('this.myRef:', this.myRef)
  }
  state = {
    userInfo: {
        name: '蒋皓天',
        job: '前端软件工程师'
    }
  }
  render() {
    return (
        <getGlobalContext.Provider value={this.state.userInfo}>
            <div>
                <h1>登录页面</h1>
                <LoginBox ref={this.myRef}></LoginBox>
                <button onClick={() => this.getRef()}>获取子组件引用</button>
            </div>
        </getGlobalContext.Provider>
    )
  }
}
